import {reqCategory,reqBannerList,reqFloorList} from '@/api';
const state={
    category:[],
    bannerList:[],
    floorList:[],
};
const mutations={
    CATEGORYLIST:(state,list) =>{
        state.category=list;
    },
    BANNERLIST:(state,list) =>{
        state.bannerList=list;
    },
    FLOORLIST:(state,list) =>{
        state.floorList=list;
    }
};
const actions={
    // categoryList类型action
    categoryList:async({commit,state,dispatch})=>{
        let result=await reqCategory();
        if (result.code==200) {
            commit('CATEGORYLIST',result.data)
        }
    },
    bannerList:async({state,commit,dispatch})=>{
        let result=await reqBannerList();
        if (result.code==200) {
            commit('BANNERLIST',result.data)
        }
    },
    floorList:async({commit,state,dispatch})=>{
        let result=await reqFloorList();
            if (result.code==200) {
                commit('FLOORLIST',result.data)
            }

    }
};
const getters={};
// 默认暴露:小仓库对外暴露的是对象<默认暴露
export default{
    state,
    mutations,
    actions,
    getters
}